clear all
set more off

cd "C:\Dropbox\Average_target_survey\replication_folder\workfiles"
use step012, clear

gen DAY=dow(Date)
*** standardize variables
foreach var in count_IT count_ITwild count_AIT count_AITwild {
    sum `var' if Date<=22144
	gen s`var' =  `var'/r(mean)
	gen s1`var' =  (`var'-r(mean))/r(sd)
	
	reg `var' i.DAY if Date<=22144
	predict s2`var', rstandard
	
	
	
}

		

*** IT that does not include AIT		
gen D2=  count_ITwild - count_AITwild

twoway (line D2 Date, lcolor(red) lpattern(solid))	 ///
	   (line count_AITwild Date, lcolor(blue) lpattern(dash))	 ///
	   , ///
	   legend(label(1 "inflation target") ///
			  label(2 "average inflation target") ///
			  rows(2) ring(0) position(1) rowgap(0.2) size(small)) ///
		graphregion(color(white)) bgcolor(white)   ///
		xline(22154, lpattern(shortdash) lwidth(normal) lcolor(black)) ///
		text(25 22157 "Announcement", orientation(vertical)) ///
		///
		xline(22097, lpattern(shortdash) lwidth(thin) lcolor(gold)) ///
		xline(22146, lpattern(shortdash) lwidth(thin) lcolor(gold)) ///
		xline(22195, lpattern(shortdash) lwidth(thin) lcolor(gold)) ///
		text(20 22100 "FOMC minutes", color(gold) orientation(vertical)) ///
		///
		xline(22076, lpattern(shortdash) lwidth(thin) lcolor(green)) ///
		xline(22125, lpattern(shortdash) lwidth(thin) lcolor(green)) ///
		xline(22174, lpattern(shortdash) lwidth(thin) lcolor(green)) ///
		xline(22224, lpattern(shortdash) lwidth(thin) lcolor(green)) ///
		text(20 22079 "FOMC press conference", color(green) orientation(vertical)) ///
		ytitle("Document count") ///
		xtitle("") ///
		xlabel(22154 22097 22146 22195 22076 22125 22174 22224, angle(30)) ///
		name(fig_raw1, replace)
		
		
twoway (line D2 Date, lcolor(black) lpattern(solid))	 ///
	   (line count_AITwild Date, lcolor(gray10) lpattern(dash) lwidth(thick))	 ///
	   , ///
	   legend(label(1 "inflation target") ///
			  label(2 "average inflation target") ///
			  rows(2) ring(0) position(1) rowgap(0.2) size(small)) ///
		graphregion(color(white)) bgcolor(white)   ///
		xline(22154, lpattern(shortdash) lwidth(normal) lcolor(black)) ///
		text(25 22157 "Announcement", orientation(vertical)) ///
		///
		xline(22097, lpattern(shortdash) lwidth(vthin) lcolor(black)) ///
		xline(22146, lpattern(shortdash) lwidth(vthin) lcolor(black)) ///
		xline(22195, lpattern(shortdash) lwidth(vthin) lcolor(black)) ///
		text(20 22100 "FOMC minutes", color(black) orientation(vertical)) ///
		///
		xline(22076, lpattern(longdash) lwidth(vthin) lcolor(black)) ///
		xline(22125, lpattern(longdash) lwidth(vthin) lcolor(black)) ///
		xline(22174, lpattern(longdash) lwidth(vthin) lcolor(black)) ///
		xline(22224, lpattern(longdash) lwidth(vthin) lcolor(black)) ///
		text(20 22079 "FOMC press conference", color(black) orientation(vertical)) ///
		ytitle("Document count") ///
		xtitle("") ///
		xlabel(22154 22097 22146 22195 22076 22125 22174 22224, angle(30)) ///
		name(fig_raw2, replace)
		
		
		
	